package ext.csc.component.numbergen.utilities;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Properties;
import wt.util.WTProperties;

public class PropertiesUtil {
	public static HashMap readProperties(String filepath) {
		HashMap propertiesMap = new HashMap();
		Properties pro = new Properties();
		try {
			String wthome = (String) (WTProperties.getLocalProperties()).getProperty("wt.home", "");
			FileInputStream fis = new FileInputStream(wthome + filepath);
			pro.load(fis);
			Enumeration e = pro.propertyNames();
			while (e.hasMoreElements()) {
				String proName = (String) e.nextElement();
				propertiesMap.put(proName, (String) pro.getProperty(proName));
			}
			fis.close();
			
		} catch (IOException ex) {
			System.out.println("Load Property File Error Message:"
					+ ex.getMessage());
		}
		return propertiesMap;
	}
}
